]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Use set_origin/set_size instead of properties when allocating
authorJonas Dreßler <verdre@v0yd.nl>
Thu, 25 Feb 2021 10:54:39 +0000 (11:54 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 9 Mar 2021 15:40:49 +0000 (15:40 +0000)
Setting four properties is more expensive than calling two C functions,
so move to set_origin()/set_size() calls for our ClutterActorBox
handling.

This gets us down to an average time of 2.1 ms spent in vfunc_allocate()
with 20 windows

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1743>

js/ui/workspace.js

index 37b13a46b1eace2119a1e871e2078094017f3101..3337b2ed069ce58a969e94decd5166356ffb09f0 100644 (file)
@@ -635,10 +635,12 @@ var WorkspaceLayout = GObject.registerClass({
             const windowInfo = this._windows.get(child);
 
             if (windowInfo.metaWindow.showing_on_its_workspace()) {
-                workspaceBox.x1 = child.boundingBox.x - this._workarea.x;
-                workspaceBox.x2 = workspaceBox.x1 + child.boundingBox.width;
-                workspaceBox.y1 = child.boundingBox.y - this._workarea.y;
-                workspaceBox.y2 = workspaceBox.y1 + child.boundingBox.height;
+                workspaceBox.set_origin(
+                    child.boundingBox.x - this._workarea.x,
+                    child.boundingBox.y - this._workarea.y);
+                workspaceBox.set_size(
+                    child.boundingBox.width,
+                    child.boundingBox.height);
             } else {
                 workspaceBox.set_origin(this._workarea.x, this._workarea.y);
                 workspaceBox.set_size(0, 0);
@@ -659,10 +661,8 @@ var WorkspaceLayout = GObject.registerClass({
                     Math.max(workspaceBox.get_height(), height));
             }
 
-            layoutBox.x1 = x;
-            layoutBox.x2 = layoutBox.x1 + width;
-            layoutBox.y1 = y;
-            layoutBox.y2 = layoutBox.y1 + height;
+            layoutBox.set_origin(x, y);
+            layoutBox.set_size(width, height);
 
             childBox = workspaceBox.interpolate(layoutBox,
                 this._stateAdjustment.value);